/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package extension.game.room.handler;

import com.smartfoxserver.v2.entities.User;
import com.smartfoxserver.v2.entities.data.ISFSObject;
import com.smartfoxserver.v2.extensions.BaseClientRequestHandler;
import extension.game.room.RoomExtension;
import java.util.Date;
import log.Debug;
import util.Common;

/**
 *
 * @author daz
 */
public class LogErrorHandler extends BaseClientRequestHandler {

    @Override
    public void handleClientRequest(User user, ISFSObject params) {
        String reason = params.getUtfString("error_reason");
        Debug.d("reason :" + reason);
        Date date = new Date();
        RoomExtension ext = (RoomExtension) getParentExtension();
        if (ext.getRoomPrefix().equals("P")) {
            Common.addToFile(date.toString() + "-Phom:" + reason, "report.txt");
        } else {
            Common.addToFile(date.toString() + "-Tienlen:" + reason, "report.txt");
        }
    }
}
